package cn.lysj.framework.common.controller;

import cn.lysj.framework.base.BaseController;
import cn.lysj.framework.common.annotation.SystemLog;
import cn.lysj.framework.common.domain.Log;
import cn.lysj.framework.common.service.LogService;
import cn.lysj.framework.common.utils.web.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author zk
 * @description 日志控制层
 * @create 2018-08-13 15:32:38
 **/
@Slf4j
@RestController
@Api(description = "日志管理接口")
@RequestMapping("/admin/log")
public class LogController extends BaseController<Log>{

    @Resource
    private LogService logService;

    @Override
    public LogService getService() {
        return logService;
    }

    @PostMapping("/deleteAll")
    @SystemLog(description = "删除所有日志")
    @ApiOperation(value = "日志删除")
    public Resp deleteAll(){
        if(getService().deleteAll()){
            return new Resp("删除成功");
        }
        return new Resp("删除失败");
    }

}
